
<html>
<head>

    <link rel="stylesheet" type="text/css" href="/META-INF/resources/static/devtools30/js/bootstrap-3.3.5/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="/META-INF/resources/static/devtools30/js/jquery-easyui-1.5/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/META-INF/resources/static/devtools30/js/jquery-easyui-1.5/themes/icon.css">
    <link rel="stylesheet" href="/META-INF/resources/static/devtools30/js/plugins/validationEngine/css/validationEngine.jquery.css" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="/META-INF/resources/static/devtools30/css/styledevtools.css">
    <link rel="stylesheet" href="/META-INF/resources/static/devtools30/js/plugins/layer/skin/layer.css" />
    <link rel="stylesheet" type="text/css" href="/static/portalres/jsfolder/htmlxjs/skins/dhtmlxgrid.css"/>
    <link rel="stylesheet" type="text/css" href="/static/portalres/jsfolder/htmlxjs/skins/dhtmlxgrid_pgn_bricks.css"/>

    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxcommon.js"></script>
    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxcontainer.js"></script>
    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxgrid.js"></script>
    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxgridcell.js"></script>
    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxgrid_filter.js"></script>
    <script type="text/javascript" src="/static/portalres/jsfolder/htmlxjs/dhtmlxgrid_pgn.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/jquery-1.11.2.min.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/bootstrap-3.3.5/bootstrap.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/jquery-easyui-1.5/datagrid-filter.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/jquery-easyui-1.5/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/my97DatePicker/WdatePicker.js" ></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/easyuiPager.js?=5"></script>

    <script src="/META-INF/resources/static/devtools30/js/plugins/validationEngine/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
    <script src="/META-INF/resources/static/devtools30/js/plugins/validationEngine/languages/jquery.validationEngine-zh_CN.js" type="text/javascript" charset="utf-8">
    </script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/ajaxfileupload.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/datagrid-dnd.js"></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/FormValidation.js"></script>

    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/commondevtools.js"></script>

    <style>
        /*去掉滚动条*/
        body{overflow-y:hidden;}
    </style>

    <script src='/static/portalres/jsfolder/htmlxjs/dhtmlxgrid_export.js'></script>
    <script type="text/javascript" src="/META-INF/resources/static/devtools30/js/md5-min.js"></script>

    <title>dhtmlDemo</title>
    <style>
        div.gridbox_dhx_terrace table.obj.row20px tr td {
            padding-top: 5px;
            padding-bottom: 5px;
            height: 32px;
        }

        button.bi-glyphicon {
            height: 27px;
            margin-top: 2px;
            border-radius: 9px;
            margin-right: 5px;
            font-size: 11px;
        }
    </style>
    <script>
        var years=null;
        var times = null;
        var selectId = null;
        var mygrid = null;
        $(function () {
            var height = findDimensions_height();
            $("#gridbox").height(height - 80);
            //获取当前日期
            var myDate = new Date();
            var nowY = myDate.getFullYear();
            var nowM = myDate.getMonth() + 1;
            var startTime = (nowY - 1) + "-" + (nowM < 10 ? "0" + nowM : nowM);//当前日期
            var endTime = (nowY ) + "-" + (nowM < 10 ? "0" + nowM : nowM);//后一个月日期
            $("#startTime").val("2015-01-01");
            $("#endTime").val(endTime);
            loadDoctor();
        })
        function refresh() {
            grid_Load();
        }

        function loadDoctor() {
            mygrid = new dhtmlXGridObject('gridbox');
            mygrid.setImagePath("/static/portalres/jsfolder/htmlxjs/imgs/");
            mygrid.setHeader("人员信息,#cspan,rq,序号");//
            mygrid.attachHeader(["ID", "name", "#rspan","#rspan"]);
            <!--设置表头-->
            // mygrid.setHeader("人员信息,#cspan,#cspan,出生日期,全国,#cspan,合计");
            // <!--设置二级表头-->
            // mygrid.attachHeader(["姓名", "编码", "性別", "#rspan","价格","数量", "#rspan"]);
            mygrid.setInitWidths("60,60,150,100");//
            mygrid.setColAlign("center,center,center,center");//
            mygrid.attachHeader("#rspan,#select_filter,#select_filter,#rspan");//
            mygrid.setColTypes("ro,ro,ro,ro");//
            mygrid.setColSorting("str,str,str,str");//
            mygrid.setSkin("dhx_terrace");
            mygrid.enablePaging(true, 80, 10, "pagingArea", true, "recinfoArea");
            mygrid.setPagingSkin("bricks");
            mygrid.attachEvent("onRowSelect", function (id, ind) {
            })
            mygrid.setColumnHidden(0, true);
            mygrid.init();
            //grid_Load();

            var grid_mw_st_month;
            grid_mw_st_month = new dhtmlXGridObject('gridbox');
            grid_mw_st_month.setImagePath("/static/portalres/jsfolder/htmlxjs/imgs/");
            grid_mw_st_month.setInitWidths("55,*,95,75,75,75,75,75,75,75,75");
            grid_mw_st_month.setHeader("核算期间,品名规格,产地,上期结存,#cspan,本期入库,#cspan,本期出库,#cspan,本期结余,#cspan");
            grid_mw_st_month.attachHeader("#rspan,#rspan,#rspan,数量,金额,数量,金额,数量,金额,数量,金额");
            grid_mw_st_month.setColAlign("center,center,center,right,right,right,right,right,right,right,right");
            grid_mw_st_month.setColTypes("ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
            grid_mw_st_month.setSkin("dhx_custom");
            grid_mw_st_month.init();
            mygrid=grid_mw_st_month;
        }
        function grid_Load() {
            var endTime = $("#endTime").val();
            var startTime = $("#startTime").val();
            var search = $("#search").val();

            var postdata = {
                p_dm: "zgn-4",
                sys_pagingfn: "1,1,9999"
            };
            $.ajax({
                url: "/commapiV2",
                type: "post",
                contentType: "application/x-www-form-urlencoded",
                data: postdata,
                dataType: "json",
                success: function (data) {
                    if (data.success) {
                        var js = data.Table;
                        mygrid.clearAll();
                        exceldata = js;
                        mygrid.parse(js, "json");
                    }
                }
            });
        }

        function eXcell_edit(cell) {
            if (cell) {                                                     //default pattern, just copy it
                this.cell = cell;
                this.grid = this.cell.parentNode.grid;
            }
            this.setValue = function (val) {
                var row_id = this.cell.parentNode.idd;
                var year = mygrid.cells(row_id, 1).getValue();
                var time = mygrid.cells(row_id, 2).getValue();
                var cValue = '';
                var row_dlsid = mygrid.cells(row_id, 0).getValue();
                cValue = cValue + '<button type=\'button\' class=\'btn btn-danger  bi-glyphicon\' onclick="showOrderSeq(\'' + row_dlsid +'\',\''+year+'\',\''+time+ '\')" >编辑</button>';
                this.setCValue(cValue);
            }
        }
        eXcell_edit.prototype = new eXcell;

        function doExcel() {
            $.messager.confirm('确认', '确认把该搜索结果导出Excel表格 ？', function (r) {
                if (r) {
                    $.messager.progress({
                        title: '处理中',
                        msg: '请稍后'
                    });
                    $.messager.progress('close');
//                    mygrid.toPDF('/ExportController/excel', 'color');
                    mygrid.toExcel('/ExportController/excel', 'color');
                }
            })
        }

        function doExcel2() {
            var postdata = {
                header: [
                    [{color:"",field:"TEST",title:"TEST",width:"100",align:"center",type:"str","colspan":3}]
                    ,[
                    {color:"",field:"ID",title:"ID",width:"100",align:"center",type:"str"},
                    {color:"",field:"NAME",title:"NAME",width:"100",align:"center",type:"str"},
                    {color:"",field:"SEX",title:"SEX",width:"100",align:"center",type:"str"}
                    ]
                ],
                rows: [
                    {ID:"123456",NAME:"米高处",SEX:"男"},
                    {ID:"223456",NAME:"名称23456",SEX:"女"}
                ],
                title: "导出测试"
            };

            var win = window.open("", "_blank");
            win.document.open();
            win.document.write("<html><body>");
            win.document.write('<form id="myform" method="post" action="/ExportController/easyuiexcelV2" accept-charset="utf-8" enctype="text/html">');
            win.document.write('  <input type="hidden" name="header" id="header"/> ');
            win.document.write('  <input type="hidden" name="rows" id="rows"/> ');
            win.document.write('  <input type="hidden" name="title" id="title"/> ');
            win.document.write('</form>');
            // as long dash in post converts to some special symbols we need to convert it to simple dash by replacing using unicode \u2013
            win.document.getElementById("header").value = encodeURIComponent(JSON.stringify(postdata.header));
            win.document.getElementById("rows").value = encodeURIComponent(JSON.stringify(postdata.rows));
            win.document.getElementById("title").value = encodeURIComponent(postdata.title);
            win.document.write("</body></html>");
            win.document.getElementById("myform").submit();
            win.document.close();
        }


    </script>
</head>
<body>
<div class="navheader form-inline" style="padding:0 5px;height:40px;">
    <input type="hidden" id="sss" name="sss"/>

    <div class=" form-group">
        <label>检索内容：</label>
        <label>报表年月：</label>
        <input type="text" class="form-control Wdate" style="width:90px;" name="startTime" id="startTime" value=""
               onclick="WdatePicker({ dateFmt: 'yyyy-MM' })">
        <span>至</span>
        <input type="text" class="form-control Wdate" style="width:90px;" name="endTime" id="endTime" value=""
               onclick="WdatePicker({ dateFmt: 'yyyy-MM' })">
        <button type="button" class="btn btn-success " onclick="search()">
            <span class="glyphicon glyphicon glyphicon-search"></span>
        </button>
    </div>
    <div class="btn-group-right">
        <div class="btn-group " role="group">
            <button type="button" class="btn btn-default bi-btn-width90" onclick="doExcel()">导出Excel</button>
            <button type="button" class="btn btn-default bi-btn-width90" onclick="doExcel2()">导出Excel2</button>
        </div>
    </div>
</div>
<div style="margin:0 5px; overflow: hidden;">
    <div style="width:100%;float:left;display:inline-block;padding-right:5px;border-right:1px dotted #ccc;">
        <table style="width: 99.8%; ">
            <tr>
                <td id="recinfoArea"></td>
            </tr>
            <tr>
                <td>
                    <div id="gridbox" style="width: 100%;height: 300px;">
                    </div>
                </td>
            </tr>
            <tr>
                <td id="pagingArea"></td>
            </tr>
        </table>

    </div>
</div>
</body>
</html>
<!--数据接口+签名测试-->
<script>
//    var goablecontentobj={
//        id:"12345",
//        name:"name",
//        name123456:"name123456",
//
//        dtapinonce :"8863237873422",
//        dtapitimestamp :Date.parse(new Date())/1000-3600*4,
//        dtsigntype :"md5",
//        dtsyscode:"zzsq"
//    };
//    var sdic = Object.keys(goablecontentobj).sort();
//    var tmpSignSource = "";
//    var requestStr="";
//    for(var i = 0; i < sdic.length; i++) {
//        if(sdic[i]=='dtsyscode'){
//            tmpSignSource =tmpSignSource+ "&" + sdic[i] + "=67890";
//            requestStr=requestStr+"&" + sdic[i] + "=zzsq";
//        }else{
//            tmpSignSource =tmpSignSource+ "&" + sdic[i] + "=" + goablecontentobj[sdic[i]];
//            requestStr=requestStr+"&" + sdic[i] + "=" + goablecontentobj[sdic[i]];
//        }
//    }
//
//    var postdata = {
//        p_dm: "zgn-4",
//        sys_pagingfn: "1,1,9999"
//    };
//
//    tmpSignSource=tmpSignSource+JSON.stringify(postdata);
//    console.log("dtsign org:"+tmpSignSource.substr(1));
//    var sign = hex_md5(tmpSignSource.substr(1));
//    console.log("dtsign sign:"+sign);
//    requestStr=requestStr+"&dtsign=" +sign;

//    $.ajax({
//        url: "/test_interface?"+requestStr.substr(1),
//        type: "post",
//        contentType: "application/json",
//        data: JSON.stringify(postdata),
//        dataType: "json",
//        success: function (data) {
//            if (data.success) {
//                var js = data.Table;
//                mygrid.clearAll();
//                exceldata = js;
//                mygrid.parse(js, "json");
//            }
//        }
//    });

</script>



<!--数据接口+签名测试 外部路由-->
<script>
    var goablecontentobj={
        id:"12345",
        name:"name",
        name123456:"name123456"
    };
    var requestStrforSign="";
    for(var oneObj in goablecontentobj){//遍历json对象的每个key/value对,p为key
        requestStrforSign=requestStrforSign+"&" + oneObj + "=" + goablecontentobj[oneObj];
    }

    var postdata = {
        p_dm: "zgn-4",
        sys_pagingfn: "1,1,9999"
    };

    $.ajax({
        url: "/SignDemoController/getSign?"+requestStrforSign.substr(1),
        type: "post",
        contentType: "application/json",
        data: JSON.stringify(postdata),
        dataType: "json",
        success: function (data) {
            if(data.success){
                goablecontentobj.dtsigntype=data.dtsigntype;
                goablecontentobj.dtsyscode=data.dtsyscode;
                goablecontentobj.dtsign=data.dtsign;
                goablecontentobj.dtapinonce=data.dtapinonce;

                var requestStr="";
                for(var oneObj in goablecontentobj){//遍历json对象的每个key/value对,p为key
                    requestStr=requestStr+"&" + oneObj + "=" + goablecontentobj[oneObj];
                }
                $.ajax({
                    url: "/DLOuterInterface/demoInter?"+requestStr.substr(1),
                    type: "post",
                    contentType: "application/json",
                    data: JSON.stringify(postdata),
                    dataType: "json",
                    success: function (data) {
                        if (data.success) {
                            var js = data.Table;
                            mygrid.clearAll();
                            exceldata = js;
                            mygrid.parse(js, "json");
                        }
                    }
                });
            }

        }
    });

</script>


<!--数据接口+签名测试 内部路由-->
<script>
    var goablecontentobj={
        id:"12345",
        name:"name",
        name123456:"name123456"
    };

    var postdata = {
        p_dm: "zgn-4",
        sys_pagingfn: "1,1,9999"
    };

    var requestStr="";
    for(var oneObj in goablecontentobj){//遍历json对象的每个key/value对,p为key
        requestStr=requestStr+"&" + oneObj + "=" + goablecontentobj[oneObj];
    }
    $.ajax({
        url: "/DLOuterInterface/demoInter?"+requestStr.substr(1),
        type: "post",
        contentType: "application/json",
        data: JSON.stringify(postdata),
        dataType: "json",
        success: function (data) {
            if (data.success) {
                var js = data.Table;
                mygrid.clearAll();
                exceldata = js;
                mygrid.parse(js, "json");
            }
        }
    });

</script>
